<?php
require("config/globalconfig.php");
require("classes/user_section.php");
user_common::writeLog('add like',1);
$strHeaderMessage= user_common::getMessageHeaderArr($banCode);
//$c_userInfo = $_SESSION[user_common::SES_C_USERINFO];

//TODO gỡ bỏ comment khi chạy

$objSection = new user_section($objConnection);

if ($_pgR["act"]=='get_select')//user_common::ACT_ADD_LIKE)//add new record like.php Trường hợp content chưa có like_id
{		
	//$sectionID = $_pgR["sect"];
	$arrSection= $objSection->getAllSection();
	if($arrSection)
	{
		$strHTML = $objSection->outputHTMLSection($arrSection);
		echo user_common::convertToXML($arrHeader, array("rs", "inf"), 
				array(1, $strHTML), array(0, 1));
		return;	
	}
	else
	{
		echo user_common::convertToXML($arrHeader, array("rs"),array(0));
		return ;
	}
}
else if($_pgR["act"]=='get_like_by_id')//user_common::ACT_GET_LIKE_BY_ID)
	{			
		
		/*
		if (!user_common::isValidID(user_common::hc_decode($_pgR["cid"]),false))
		{
			echo $strHeaderMessage."0";
			return;
		}
		*/
		
		$like = new user_like($objConnection);
		//$like->outputLikeToHTML(1,)
		$strContentID = user_common::hc_decode($_pgR["cid"]);
		
		$iContentType= $_pgR["itype"];
		$strHTML = $like->outputLikeToHTML($iContentType,$strContentID);
		//echo "HTML".$strHTML;
		//echo $strHeaderMessage."1".user_common::SEP_RESPONSE.$strHTML;
		echo user_common::convertToXML($arrHeader, array("rs", "inf"), 
				array(1, $strHTML), array(0, 1));
		return;	
	}
	


?>
